package vashion.azeroth.back.controller.system;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import vashion.azeroth.api.controller.base.BaseController;
import vashion.azeroth.core.item.dao.OperateFlowDao;
import vashion.azeroth.core.pojo.common.OperateFlowDO;
import vashion.azeroth.core.result.ApiResult;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by liuhe on 15/12/3.
 */
@Controller
@RequestMapping("/back/operateflow")
public class OperateFlowController extends BaseController {

    private final static Logger log = LoggerFactory.getLogger(OperateFlowController.class);

    @Autowired
    private OperateFlowDao operateFlowDao;

    @RequestMapping("list.htm")
    @ResponseBody
    public ApiResult<List<OperateFlowDO>> list(HttpServletRequest request,
                                               @ModelAttribute("operateFlowDO") OperateFlowDO operateFlowDO) {

        List<OperateFlowDO> operateFlowDOList = operateFlowDao.find(operateFlowDO);
        ApiResult<List<OperateFlowDO>> listResult = ApiResult.newSuccessResult(operateFlowDOList);
        listResult.setTotalCount(operateFlowDao.findCnt(operateFlowDO));
        return listResult;
    }
}
